package cn.bblocks.cacheTest.model;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Date;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;



import cn.bblocks.cacheTest.suport.BaseDomain;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;


@Data
@Entity
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "area")
public class Area implements Serializable {
	
    @Id
    @Column(name = "areaId")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer areaid;

    private String areacode;

    private String areaname;

    private Integer level;

    private String citycode;

    private String center;

    private Integer parentid;
    
    private Date updateTime;
    
    
    
    public static void main (String[] args) {
    	
    	Area testobj = new Area();
    	testobj.setAreaid(1111);
    	 
         Class clazz = testobj.getClass();
  
         Method[] method = clazz.getDeclaredMethods();
         
         Field[] fs = clazz.getDeclaredFields();
         
         //用来记录测试产生的 log 信息
         StringBuilder log = new StringBuilder();
         // 记录异常的次数
         int errornum = 0;
  
         for ( Field f: fs ) {
             // 只有被 @Jiecha 标注过的方法才进行测试
             if ( f.isAnnotationPresent( Id.class )) {
                System.out.println(f.getName());
                try {
					System.out.println(f.get(testobj));
				} catch (IllegalArgumentException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
                
             }
         }
  
  
         log.append(clazz.getSimpleName());
         log.append(" has  ");
         log.append(errornum);
         log.append(" error.");
  
         // 生成测试报告
         System.out.println(log.toString());

    	
    }
    
}